<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    //浅拷贝中  - 拷贝出来的目标对象的地址和源对象的地址的内存空间是同一块空间 让几个对象共用一个内存
    var father = {
      age: 25,
      name: '张三',
      sex: '男',
      hobby: [1, 2, 3, 4],
      say: function () {
        console.log('father');
      },
      son: {
        name: '小明', sex: '男'
      }
    }
    var people = {}
    Object.assign(people, father)
    people.name = '李四'
    people.hobby[1] = 9
    people.say = function () {
      console.log('people');
    }
    people.son.name = '小米'
    console.log(father);
    console.log(people);
  </script>
</body>

</html>